package com.example.tliasfight.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.example.tliasfight.Interceptor.loginCheckInterceptor;
@Configuration
//当前类是一个配置类，  作用：配置拦截器
public class WebConfig implements WebMvcConfigurer
{   @Autowired
    private loginCheckInterceptor logincheckinterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry)
    {
        registry.addInterceptor(logincheckinterceptor).addPathPatterns("/**").excludePathPatterns("/login");//添加一个拦截器，把我刚刚自定义的拦截器提供过去
    }
}
